package com.x.Part12_Object.equalsApply;

/**
 * ClassName: Account
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.02.29 20:51
 */
public class Account {

    private double balance;
    public Account(){}

    public Account(double balance) {
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Account account = (Account) o;

        return Double.compare(account.balance, balance) == 0;
    }
}
